package com.travel.recommend.service.impl;

import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.travel.common.utils.PageUtils;
import com.travel.common.utils.Query;

import com.travel.recommend.dao.DecayFunctionDao;
import com.travel.recommend.entity.DecayFunctionEntity;
import com.travel.recommend.service.DecayFunctionService;


@Service("decayFunctionService")
public class DecayFunctionServiceImpl extends ServiceImpl<DecayFunctionDao, DecayFunctionEntity> implements DecayFunctionService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<DecayFunctionEntity> page = this.page(
                new Query<DecayFunctionEntity>().getPage(params),
                new QueryWrapper<DecayFunctionEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public DecayFunctionEntity getNowDecayFunction() {
        return this.baseMapper.selectOne(new QueryWrapper<DecayFunctionEntity>().eq("now_config",1));
    }

}